using System;

namespace Mono4Delphi
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			Console.WriteLine ("Hello World!");
		}
		
		private ITForm Form1;
		
		public void InitPlugin(ITForm f)
		{
			Form1 = f;
			ITButton btn = (ITButton)f.FindComponent("Button1");
			btn.OnClick += HandleBtnOnClick;
			ITEdit edit1 = (ITEdit)f.FindComponent("Edit1");
			edit1.OnKeyPress += HandleEdit1OnKeyPress;
		}

		void HandleBtnOnClick (ITObject sender)
		{
			ITButton btn = (ITButton)sender;
			ITMemo memo1 = (ITMemo)Form1.FindComponent("Memo1");
			memo1.Lines.Add(btn.Caption);
		}

		void HandleEdit1OnKeyPress (ITObject sender, ref char Key)
		{
			Key = char.ToUpper(Key);		
		}		
	}
}

